package com.xiaozhengkeji.springboot.frame.easy.service.impl;

import com.xiaozhengkeji.springboot.frame.easy.dao.SysPayOrderDao;
import com.xiaozhengkeji.springboot.frame.easy.entity.SysPayOrder;
import com.xiaozhengkeji.springboot.frame.easy.service.SysPayOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SysPayOrder)表服务实现类
 *
 * @author makejava
 * @since 2020-08-15 20:32:22
 */
@Service("sysPayOrderService")
public class SysPayOrderServiceImpl implements SysPayOrderService {
    @Resource
    private SysPayOrderDao sysPayOrderDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SysPayOrder queryById(Integer id) {
        return this.sysPayOrderDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<SysPayOrder> queryAllByLimit(int offset, int limit) {
        return this.sysPayOrderDao.queryAllByLimit(offset, limit);
    }

    /**
     * 查询全部数据
     *
     * @return 对象列表
     */
    @Override
    public List<SysPayOrder> queryAll(SysPayOrder entity) {
        return this.sysPayOrderDao.queryAll(entity);
    }

    /**
     * 新增数据
     *
     * @param sysPayOrder 实例对象
     * @return 实例对象
     */
    @Override
    public SysPayOrder insert(SysPayOrder sysPayOrder) {
        this.sysPayOrderDao.insert(sysPayOrder);
        return sysPayOrder;
    }

    /**
     * 修改数据
     *
     * @param sysPayOrder 实例对象
     * @return 实例对象
     */
    @Override
    public SysPayOrder update(SysPayOrder sysPayOrder) {
        this.sysPayOrderDao.update(sysPayOrder);
        return this.queryById(sysPayOrder.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.sysPayOrderDao.deleteById(id) > 0;
    }
}
